import request from '@/utils/request'

// 获取正在进行的拍卖
export function getOngoingAuctions(query) {
  return request({
    url: '/merchant/auction/front/ongoing',
    method: 'get',
    params: query
  })
}

// 获取即将开始的拍卖
export function getUpcomingAuctions(query) {
  return request({
    url: '/merchant/auction/front/upcoming',
    method: 'get',
    params: query
  })
}

// 获取已结束的拍卖
export function getEndedAuctions(query) {
  return request({
    url: '/merchant/auction/front/ended',
    method: 'get',
    params: query
  })
}

// 获取拍卖详情
export function getAuctionDetail(id) {
  return request({
    url: '/merchant/auction/front/' + id,
    method: 'get'
  })
}

// 参与竞拍
export function submitBid(data) {
  return request({
    url: '/merchant/auction/front/bid/' + data.auctionId,
    method: 'post',
    data: {
      price: data.price
    }
  })
}

// 设置开拍提醒
export function setAuctionReminder(id) {
  return request({
    url: '/merchant/auction/front/remind/' + id,
    method: 'post'
  })
}

// 获取竞拍记录
export function getAuctionRecords(id) {
  return request({
    url: '/merchant/auction/front/history/' + id,
    method: 'get'
  })
}

// 结束拍卖（用户端）
export function endAuction(id) {
  return request({
    url: '/merchant/auction/front/end/' + id,
    method: 'post'
  })
} 